void vmem_realloc(vmem_t*, size_t);
-#define ARGTYPE_UNKNOWN 0
-#define ARGTYPE_INT 0x00000001
-#define ARGTYPE_FLOAT 0x00000002
-#define ARGTYPE_STRING 0x00000003
-#define ARGTYPE_BOOL 0x00000004
-#define ARGTYPE_FILE 0x00000005
-#define ARGTYPE_OUTFILE 0x00000006
-#define ARGTYPE_REQUIRED 0x40000000
-#define ARGTYPE_HIDDEN 0x20000000
+#define ARGTYPE_UNKNOWN 0x00000000
+#define ARGTYPE_INT 0x00000001
+#define ARGTYPE_FLOAT 0x00000002
+#define ARGTYPE_STRING 0x00000003
+#define ARGTYPE_BOOL 0x00000004
+#define ARGTYPE_FILE 0x00000005
+#define ARGTYPE_OUTFILE 0x00000006
+
+/* REQUIRED means that the option is required to be set.
+ * See also BEGIN/END_REQ */
+#define ARGTYPE_REQUIRED 0x40000000
+
+/* HIDDEN means that the option does not appear in help texts. Useful
+ * for debugging or testing options */
+#define ARGTYPE_HIDDEN 0x20000000
+
+/* BEGIN/END_EXCL mark the beginning and end of an exclusive range of
+ * options. No more than one of the options in the range may be selected
+ * or set. If exactly one must be set, use with BEGIN/END_REQ
+ * Both of these flags set is just like neither set, so avoid doing that. */
+#define ARGTYPE_BEGIN_EXCL 0x10000000
+#define ARGTYPE_END_EXCL 0x08000000
+
+/* BEGIN/END_REQ mark the beginning and end of a required range of
+ * options. One or more of the options in the range MUST be selected or set.
+ * If exactly one must be set, use with BEGIN/END_EXCL
+ * Both of these flags set is synonymous with REQUIRED, so use that instead
+ * for "groups" of exactly one option. */
+#define ARGTYPE_BEGIN_REQ 0x04000000
+#define ARGTYPE_END_REQ 0x02000000
#define ARGTYPE_TYPEMASK 0x00000fff
#define ARGTYPE_FLAGMASK 0xfffff000
static
arglist_t dup_args[] = {
{"shortname", &snopt, "Suppress duplicate waypoints based on name",
- NULL, ARGTYPE_BOOL},
+ NULL, ARGTYPE_BEGIN_REQ | ARGTYPE_BOOL},
{"location", &lcopt, "Suppress duplicate waypoint based on coords",
- NULL, ARGTYPE_BOOL},
+ NULL, ARGTYPE_END_REQ | ARGTYPE_BOOL},
{"all", &purge_duplicates, "Suppress all instances of duplicates",
NULL, ARGTYPE_BOOL},
{"correct", &correct_coords, "Use coords from duplicate points",
static
arglist_t stackfilt_args[] = {
{"push", &opt_push, "Push waypoint list onto stack", NULL,
- ARGTYPE_BOOL},
- {"copy", &opt_copy, "Copy waypoint list when pushing", NULL,
- ARGTYPE_BOOL},
+ ARGTYPE_BEGIN_EXCL | ARGTYPE_BEGIN_REQ | ARGTYPE_BOOL},
{"pop", &opt_pop, "Pop waypoint list from stack", NULL,
ARGTYPE_BOOL},
- {"append", &opt_append, "Append list when popping", NULL,
- ARGTYPE_BOOL},
- {"discard", &opt_discard, "Discard top of stack when popping",
- NULL, ARGTYPE_BOOL},
- {"replace", &opt_replace, "Replace list with top of stack (default)",
- NULL, ARGTYPE_BOOL},
{"swap", &opt_swap, "Swap waypoint list with <depth> item on stack",
+ NULL, ARGTYPE_END_EXCL | ARGTYPE_END_REQ | ARGTYPE_BOOL},
+ {"copy", &opt_copy, "(push) Copy waypoint list", NULL,
+ ARGTYPE_BOOL},
+ {"append", &opt_append, "(pop) Append list", NULL,
+ ARGTYPE_BEGIN_EXCL | ARGTYPE_BOOL},
+ {"discard", &opt_discard, "(pop) Discard top of stack",
NULL, ARGTYPE_BOOL},
- {"depth", &opt_depth, "Item to use when swapping", NULL, ARGTYPE_INT},
+ {"replace", &opt_replace, "(pop) Replace list (default)",
+ NULL, ARGTYPE_END_EXCL | ARGTYPE_BOOL},
+ {"depth", &opt_depth, "(swap) Item to use (default=1)",
+ NULL, ARGTYPE_INT},
{"nowarn", &nowarn, "Suppress cleanup warning", NULL,
- ARGTYPE_INT | ARGTYPE_HIDDEN},
+ ARGTYPE_BOOL | ARGTYPE_HIDDEN},
{0, 0, 0, 0, 0}
};